﻿/*
 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved.
 */

#ifndef UPGRADEDLG_H
#define UPGRADEDLG_H

#include <QTimer>
#include "BurnDlg/AboutWindow.h"
#include "BurnDlg/BinFileModel.h"
#include "BurnDlg/ChangeChip.h"
#include "ui_UpgradeDlg.h"

namespace UpgradeDlgClass {
class UpgradeDlg : public QMainWindow {
    Q_OBJECT
public:
    explicit UpgradeDlg(QWidget *parent = nullptr);
    ~UpgradeDlg() override;
protected slots:
    void SlotCbnSetfocusComboCom();
    void SlotBnClickedButtonSelectfile();
    void SlotBtnStart();
    void SlotBtnStop();
    void SlotStartTimerOut();
    void SlotShowAbout();
    void SlotShowChangeChip();
    void SlotChanceChipVersion(const QString &version);
    void SlotSetEnglish();
    void SlotSetChinese();
protected:
    void InitConnect();
    void AnalyseBinFile(QString filePath);
    DWORD CheckVersion();
    void ResetState();
    DWORD GetFileType();
    unsigned long MutParsePkghead(const QString &pszImgFileName);
    unsigned long ParseBinHeader(const QString &pszImgFileName);
    void InitTableView();
    void SlotBnClickedTableHeader(int logicalIndex);
    bool CheckImgFile(QString imgFileName);
private:
    Ui::UpgradeDlg *ui;
    unsigned int policyVersion;
    QMap<QString, DWORD> fileTypeMap;
    QString strExt;
    QString tempPath;
    QTimer startTimer;
    BurnDlg::AboutWindow *aboutWin;
    QAction *actAbout;
    QAction *actChangeChip;
    BurnDlg::BinFileModel* binModel;
    BurnDlg::ChangeChip *changeChip;
    MyStringClass::StringClass stringClass;
    QAction *actEnglish;
    QAction *actChinese;
    QMenu *menuWifiLanguage;
};
}
#endif // UPGRADEDLG_H
